package GameMain.View.Loading
{
	import Engine.Module.ModuleBase;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	public class Loading extends ModuleBase
	{
		
		private var _pre_mc:MovieClip;
		private var _pre_txt:TextField;
		
		public function Loading(p_content:Sprite=null)
		{
			super(p_content);
			this.x = 0;this.y = 0;
			this.initUI();
		}
		
		private function initUI():void
		{
			this._pre_mc = this._content["LOAD_BAR"] as MovieClip;
			this._pre_txt = this._content["MATCH_TEXT"] as TextField;
			this.reset();
		}
		
		private function reset():void
		{
			this._pre_txt.text = "";
			this._pre_mc.gotoAndStop(0);
		}
		
		public function setLoadingInfo(step:int):void
		{
			this._pre_txt.text = String(step) + "%";
			this._pre_mc.gotoAndStop(step);
		}
		
		override protected function onDisposeBack():void
		{
			this.reset();
		}
		
	}
}